/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-01-12 09:35:49
 * @LastEditTime : 2023-05-26 15:33:28
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\BIMPlan.jsx
 * @Description  :
 */

import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton, ForgeProgressWindowBtn, CommonButton } from '../Common/options'

export const BIMPlan = async ({ url, OptionsEvent, ClientData, Permission }) => {
    let data = {
        type: '模型进度',
        pageSize: 10,
        params: { pageIndex: 1 },
        hideInSearch: true,
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission?.findIndex(v => v.uuid === 'ea561549-6ce9-44f2-9405-f8e999916db9') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增模型计划进度" />
            ),
        ],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.tableName, valueType: 'Date', picker: 'month' },
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    const { tableName } = record
                    return [
                        Permission.findIndex(v => v.uuid === 'ee3b75f3-1979-4031-892d-70a6c96a8c54') !== -1 && (
                            <ModDataButton
                                OptionsEvent={OptionsEvent}
                                key="modify"
                                title="修改"
                                url={url}
                                data={record}
                            />
                        ),
                        <CommonButton
                            key="inst"
                            title="进度信息"
                            OptionsEvent={OptionsEvent}
                            data={{
                                smallTitle: tableName + ' 计划进度信息',
                                record,
                                type: 'Mars3DPlannedProgress',
                                width: '90vw',
                            }}
                        />,
                        // Permission.findIndex(v => v.uuid === 'ee82c8d8-9a65-46a5-856f-2dd46f5e2cff') !== -1 && (
                        //     <ForgeProgressWindowBtn key="planAdd" title="进度信息" type="planAdd" data={record} />
                        // ),
                        // Permission.findIndex(v => v.uuid === '9aceffb7-7828-45b2-94df-d9e10ba77d07') !== -1 && (
                        //     <ForgeProgressWindowBtn key="planDel" title="查看进度" type="planDel" data={record} />
                        // ),
                        Permission.findIndex(v => v.uuid === 'd81b1d5d-df09-4fc8-b729-7ce23e0aa0e9') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return data
}
